function GetWindowsDir : String;
   var
      pcWindows         : PChar;
      dwWDSize           : DWORD;
   begin
      dwWDSize := MAX_PATH + 1;
      GetMem( pcWindows, dwWDSize );  
      try
         if Windows.GetWindowsDirectory( pcWindows, 
                                                                     dwWDSize ) <> 0 then
            Result := pcWindows;
      finally
         FreeMem( pcWindows);
      end;
   end;
